
export const storageData = {
	getLoginUser: function() {
		try {
			const userStr = uni.getStorageSync('loginUser');
			if (userStr) {
				return JSON.parse(userStr)
			}
		} catch (e) {
			console.error('获取登录用户信息异常')
			console.error(e)
		}
		return null
	},
	
	saveLoginUser: function(user) {
		uni.setStorageSync('loginUser' , JSON.stringify(user))
	},
	
	removeLoginUser: function() {
		uni.clearStorage()
	},
	
	saveDataJSON: function(key, val) {
		uni.setStorageSync(key , JSON.stringify(val))
	},
	
	saveData: function(key, val) {
		uni.setStorageSync(key , val)
	},
	
	getDataJSON: function(key) {
		const data = uni.getStorageSync(key)
		console.log('sss: a' + data + 'a')
		if (data && data.length > 0) {
			return JSON.parse(data)
		}
		return data
	},
	getData: function(key) {
		const data = uni.getStorageSync(key)
		return data
	}
}